package com.lg.mengbase;

import android.view.View;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.lg.baselibrary.activity.BaseActivity;
import com.lg.baselibrary.utils.EditTextClearHandler;
import com.lg.baselibrary.utils.KeyBoardChangeListener;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by ligang on 2017/5/31.
 * description：
 */

public class TestKeyboardListenerAty extends BaseActivity implements KeyBoardChangeListener.KeyBoardListener {

    @BindView(R.id.login_img_exit)
    ImageView loginImgExit;
    @BindView(R.id.login_img_logo)
    ImageView loginImgLogo;
    @BindView(R.id.login_tv_phone)
    CheckBox loginTvPhone;
    @BindView(R.id.login_tv_account)
    CheckBox loginTvAccount;
    @BindView(R.id.login_ll_top)
    LinearLayout loginLlTop;
    @BindView(R.id.fragment_login_et_phone)
    EditText fragmentLoginEtPhone;
    @BindView(R.id.fragment_login_img_clear)
    ImageView fragmentLoginImgClear;
    @BindView(R.id.fragment_login_tv_type)
    TextView fragmentLoginTvType;
    @BindView(R.id.fragment_login_tv_login)
    TextView fragmentLoginTvLogin;
    @BindView(R.id.login_tv_social)
    TextView loginTvSocial;
    @BindView(R.id.login_tv_help)
    TextView loginTvHelp;
    @BindView(R.id.login_ll_bottom)
    LinearLayout loginLlBottom;
    @BindView(R.id.tagView)
    View tagView;

    @Override
    protected int provideContentViewLayout() {
        return R.layout.activity_test_keyboard;
    }

    @Override
    protected void initView() {
        ButterKnife.bind(this);
        new KeyBoardChangeListener(this).setKeyBoardListener(this);
        new EditTextClearHandler().init(fragmentLoginEtPhone, fragmentLoginImgClear);

    }

    @Override
    protected void initData() {

    }

    @Override
    public void onKeyboardChange(boolean isShowKeyboard) {
        if (isShowKeyboard) {
            loginImgExit.setVisibility(View.GONE);
            loginImgLogo.setVisibility(View.GONE);
            loginLlBottom.setVisibility(View.GONE);
            tagView.setVisibility(View.GONE);
        } else {
            loginImgExit.setVisibility(View.VISIBLE);
            loginImgLogo.setVisibility(View.VISIBLE);
            loginLlBottom.setVisibility(View.VISIBLE);
            tagView.setVisibility(View.VISIBLE);
        }
    }


    @OnClick({R.id.login_img_exit})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.login_img_exit:
                onBackPressed();
                break;
        }
    }
}
